home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Check if a file exists?
- Date: Sun, 14 Apr 96 11:29:38 GMT
- Organization: none
- Message-ID: <829481378snz@genesis.demon.co.uk>
- References: <4kp7pg$upe@news-s01.ny.us.ibm.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4kp7pg$upe@news-s01.ny.us.ibm.net>
- bfilone@ibm.net "bfilone@ibm.net " writes:
-
- >Is it possible in C to check if a file exists other than checking for a
- > succesful fopen?
-
- There is no other way in standard C. The only standard C library functions
- that actually take a filename are fopen, freopen, rename and remove.
-
- >ON a unix machine, I just want to know if a file is there or not, do not
- >to read or write anything to it. similar to the -f test in unix?
-
- That would be implemented in Unix using stat(), however that isn't a standard
- C library function. For further information on Unix specific calls see
- comp.unix.programmer.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-